<?php

/**
 * IndexController - The default controller class
 * 
 * @author
 * @version 
 */

require_once 'Zend/Controller/Action.php';

class Adminb_EorderController extends Zend_Controller_Action 
{
	

	
	public function init(){
		
		$member=new CMember();
		
		if(!$member->isUser($this->_request->getModuleName(),$this->_request->getControllerName())){
			
			if($_COOKIE[COOKIE_PRE.'uid']!=''){
				
				$this->_redirect(MY_URL.'/seller');
				
			}else{
			
				$this->_redirect(MY_URL.'/seller-auth-login');
				
			}
			
		}
		
	}
	
	public function preDispatch()
	{

		$this->getHelper ('layout')->setLayout('framelayout');
		
		$this->view->addHelperPath(MY_ROOT.'/vhelpers');
		
		Zend_Controller_Action_HelperBroker::addPath(MY_ROOT.'/chelpers');

	}
	
	public function allAction(){
		
		$page=$this->_request->getParam("page",1);
		
		$order=new CExpressOrder();
		
		$counts=$order->getAllOrderCounts("uid='".$_COOKIE[COOKIE_PRE.'uid']."'");
		
    	Zend_Loader::loadClass("CFilter");
    	
    	$pageArray = CFilter::filterPage ( $page, $counts, 10 );
		
		$itemArray=$order->getAllOrders($pageArray['from'],10,"uid='".$_COOKIE[COOKIE_PRE.'uid']."'");
		
		Zend_Loader::loadClass("CPage");
    	
    	$pageString = CPage::divPages( $pageArray ['pageNumber'], $pageArray ['page'], ROOT_PATH."/adminb-eorder-all?"); //生成分页字符串
    	
    	$this->view->assign ( "pageString", $pageString );
    	
    	$this->view->assign ( "pageArray", $pageArray );

		$this->view->assign ( 'itemArray', $itemArray );
		
	}
	
	public function moreAction(){
		
		$order=new CExpressOrder();
		
		$orderid=$this->_request->getParam("orderid");
		
		$orderArray=$order->getDetail($orderid);
		
		$this->view->assign ( 'orderArray', $orderArray );
		
		$fenlei=new CFenlei('express_order');
		
		$stateArray=$fenlei->getFenleiByPid(0);
		
		$this->view->assign ( 'stateArray', $stateArray );
		
	}
	

   	
	public function postAction(){
	
		//$this->_helper->viewRenderer->setNoRender();
		
		//$this->getHelper ('layout')->disableLayout ();
	
	}
    

    
}
